req_json = {
    "article_title": "黑神话的意义",
    "chapters": [
        {
            "chapter_name": "《黑神话：悟空》的成功标志着中国游戏行业质的飞跃",
            "sub_chapters": [
                {"sub_chapter_name": "技术创新与艺术表现力的提升"},
                {"sub_chapter_name": "打破国际巨头垄断，展现中国游戏实力"},
                {"sub_chapter_name": "推动中国游戏行业向高质量发展"}
            ]
        },
        {
            "chapter_name": "《黑神话：悟空》对中国传统文化的传承与传播起到了重要作用",
            "sub_chapters": [
                {"sub_chapter_name": "以孙悟空形象为核心的文化符号传播"},
                {"sub_chapter_name": "游戏剧情与中华文化的深度结合"},
                {"sub_chapter_name": "促进传统文化的现代化表达"}
            ]
        },
        {
            "chapter_name": "增强了国内文化产业从业者的文化自信，证明了中国文化在现代娱乐产业中具有强大的生命力和吸引力",
            "sub_chapters": [
                {"sub_chapter_name": "提振国内游戏开发者信心"},
                {"sub_chapter_name": "展示中国故事的全球吸引力"},
                {"sub_chapter_name": "推动中国文化走向世界舞台"}
            ]
        },
        {
            "chapter_name": "《黑神话：悟空》对玩家和市场也产生了深远影响",
            "sub_chapters": [
                {"sub_chapter_name": "提升玩家对中国文化的认同感"},
                {"sub_chapter_name": "激发玩家对中国历史的兴趣"},
                {"sub_chapter_name": "带动相关周边产品的热销"}
            ]
        }
    ]
}


text_data = {
  "article_title": "黑神话的意义",
  "chapters": [
    {
      "chapter_name": "《黑神话：悟空》的成功标志着中国游戏行业质的飞跃",
      "sub_chapters": [
        {
          "sub_chapter_name": "技术创新与艺术表现力的提升"
        },
        {
          "sub_chapter_name": "打破国际巨头垄断，展现中国游戏实力"
        },
        {
          "sub_chapter_name": "推动中国游戏行业向高质量发展"
        }
      ]
    },
    {
      "chapter_name": "《黑神话：悟空》对中国传统文化的传承与传播起到了重要作用",
      "sub_chapters": [
        {
          "sub_chapter_name": "以孙悟空形象为核心的文化符号传播"
        },
        {
          "sub_chapter_name": "游戏剧情与传统故事的巧妙结合"
        },
        {
          "sub_chapter_name": "增强民族文化认同感"
        }
      ]
    },
    {
      "chapter_name": "增强了国内文化产业从业者的文化自信，证明了中国文化在现代娱乐产业中具有强大的生命力和吸引力",
      "sub_chapters": [
        {
          "sub_chapter_name": "提振从业者信心，激发创作热情"
        },
        {
          "sub_chapter_name": "展示中国文化的独特魅力"
        },
        {
          "sub_chapter_name": "吸引全球玩家关注中国文化"
        }
      ]
    },
    {
      "chapter_name": "《黑神话：悟空》对玩家和市场也产生了深远影响",
      "sub_chapters": [
        {
          "sub_chapter_name": "改变玩家对中国游戏的看法"
        },
        {
          "sub_chapter_name": "推动市场对高质量国产游戏的需求"
        },
        {
          "sub_chapter_name": "促进游戏产业链上下游协同发展"
        }
      ]
    }
  ]
}

import json

def test_json_format(text):
    data = json.loads(text)
    # 将子章节根据顺序拼接成字符串
    result = {}
    result_dict = {}
    for data_index,chapter in enumerate(data["chapters"]):
        result_text = ''
        for index,sub_chapter in enumerate(chapter["sub_chapters"]):
            result_text += str(index+1)+'. '+sub_chapter["sub_chapter_name"] + " "
        result_dict[str(data_index+1) + '.'+ chapter["chapter_name"]] = result_text
    result['result'] = result_dict
    print(result)

def test_json_format_2(text):
    data = json.loads(text)
    # 将子章节根据顺序拼接成字符串
    result = []
    for data_index, chapter in enumerate(data["chapters"]):
        result_dict = {}
        result_text = ''
        for index, sub_chapter in enumerate(chapter["sub_chapters"]):
            result_text += str(index + 1) + '. ' + sub_chapter["sub_chapter_name"] + " "
        result_dict['chapters'] = str(data_index + 1) + '. '+ chapter["chapter_name"]
        result_dict['sub_chapters'] = result_text
        result.append(result_dict)
    return result


if __name__ == '__main__':
    test_json_format_2(json.dumps(text_data))